#pragma once
/*!
* \file  ui_single_object_viewer.h
* \brief 
* 
*
* 
* \author patdz@qq.com
* \version 1.0
* \date 2014/06/22
*/
#include "ui_control.h"
#include "ui_slider.h"

_SSL_BEGIN
_SSUIL_BEGIN

#pragma warning(push)
#pragma warning(disable:4250)

class UISingleObjectViewer :
	public UIControl
{
public:
	UISingleObjectViewer();
	virtual ~UISingleObjectViewer();

public:
	virtual bool ApplyAttributes(IUIBuilderInterface *ui_builder, 
		IUIXMLDocumentInterface *xml_document, UIXmlNode node);
	virtual void DoEvent(UIEvent &evt);
	virtual UINT GetProperties();
	virtual bool AddChild(IUIControlInterface *control);

protected:
	virtual void OnRecalcChildsLayoutOnSizeChange();

protected:
	virtual int GetControlAutoWidth();
	virtual int GetControlAutoHeight();

	//
public:
	bool ScrollToTop();
	bool ScrollToLeft();
	bool ScrollToControl(IUIControlInterface *control);
public:
	void SetHorizontalSlider(UISlider *hs);
	void SetVerticalSlider(UISlider *vs);

protected:
	bool SetXOffset(int new_offset);
	bool SetYOffset(int new_offset);

protected:
	bool DelegateOnSliderNotify(void* tag);

protected:
	int view_x_offset_;
	int view_y_offset_;

	int view_x_offset_min_;
	int view_x_offset_max_;
	int view_y_offset_min_;
	int view_y_offset_max_;

	tstring horizontal_slider_name_;
	tstring vertical_slider_name_;
	scoped_ref_ptr<UISlider> horizontal_slider_;
	scoped_ref_ptr<UISlider> vertical_slider_;
};

#pragma warning(pop)

_SSUIL_END
_SSL_END
